package com.houmeiyuan.huiguniang.modles.dao;

import com.houmeiyuan.huiguniang.modles.domain.ShopCar;
import com.houmeiyuan.huiguniang.modles.domain.ShopCarDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Repository
@Transactional
@Mapper
public interface ShopCarDao {

    List<ShopCar> searchByProductNumber(@Param("productNumber") Integer productNumber);
    /* select count(*) from `shopcar` where openId=#{openId} and productId=#{productId} */
    public Integer checkProduct(Map<String, Object>mp);
     /**insert into `shopcar`(openId,productId,status,productNumber) values ( #{openId},#{productId},1,#{productNumber})
     * 这边插入数据目前还不完善 还缺少商品价格、商品名称等
     */
    public Integer addProduct(Map<String,Object>mp);
    /*update shopcar set productNumber=productNumber +#{productNumber} where openId={openId} and productId=#{productId}*/
    public Integer updateProduct2(Map<String,Object>mp);
    List<ShopCarDetail> selectAll(Map<String,Object> params);//注意设置返回类型List
    public Integer deleteProduct(Map<String,Object> mp);


    Integer updateShopCar(Map<String,Object> params);

    Integer allSelect(ShopCar shopCar);


}
